<include file="Finance:leftmenu" />
<div class="content-right fl">

    <h1 class="content-right-title">重消账户流水</h1>
    
    <div class="tablesWrap">

        <form action="" method="get" name="form1">
            <div class="tables-searchbox">
                <input type="text" class="input" name="order_id" id="order_id" value="<?php echo get('order_id');?>" placeholder="订单ID">
                <input type="text" class="input" name="user_id" id="user_id" value="<?php echo get('user_id');?>" placeholder="用户ID">
                <select name="logtype" class="select mini" id="logtype">
                        <option value="" <?php echo (get("logtype") == "") ? "selected" : "";?> >类型</option>
                        <option value="0" <?php echo (get("logtype") == "0" && (get("logtype") !='')) ? "selected" : "";?> >支出</option>
                        <option value="1" <?php echo (get("logtype") == "1") ? "selected" : "";?> >收入</option>
                </select>
                <button class="btn btn-primary"><i class="gicon-search white"></i>查询</button>
                <a href="/admin/finance/liushui" class="btn btn-warning">清除查询</a>
                
<a class="btn btn-success " href="javascript:excel();"><i class="gicon-share white"></i>导出</a>

                <input type="hidden" name="action" value="">
            </div>
        </form>
  
        
        <table class="wxtables">
         	<colgroup>
         		<col width="3%">
               <col width="5%">
               <col width="6%">
               <col width="6%">
                <col width="6%">
                <col width="6%">
                <col width="6%">
                <col width="6%">
                <col width="6%">
                <col width="6%">
                <col width="6%">
                
                <col width="5%">


                <col width="5%">

            </colgroup>
            <thead>
            <tr>
                <td>编号</td>
                <td>用户id</td>
                <td>用户昵称</td>
                <td>描述</td>
                <td>类型</td>
                <td>金额</td>
                <td>订单金额</td>
                <td>级别</td>
                <td>订单号</td>
                
                <td>下单人id</td>
                <td>下单人昵称</td>

                <td>付款时间</td>



                
            </tr>
            </thead>
            <tbody>
            
            
<?php foreach($datalist as $k=>$v){ ?>
            <tr>
                <td><?php echo $v['log_id'];?></td>
                <td><a style="color:blue;" href="/admin/member/index?user_id=<?php echo $v['uid'];?>" target="_blank"><?php echo $v['uid'];?></a></td>
                <td><?php echo $v['realname']?$v['realname']:$v['nickname'];?></td>
                <td><?php echo $v['content'];?></td>
                <td><?php echo $v['logtype'] ? "<span style='color:red'>收入</span>" : "<span style='color:green'>支出</span>";?></td>
                <td><?php echo $v['money'];?></td>
                <td><?php echo $v['order_paymoney'];?></td>
                <td><?php echo $v['from_jibie'];?></td>
                <td><a style="color:blue;" href="/admin/order/index/status/7?order_id=<?php echo $v['order_id'];?>" target="_blank"><?php echo $v['order_id'];?></a></td>
                
                <td><a style="color:blue;" href="/admin/order/index/status/7?order_user_id=<?php echo $v['order_uid'];?>" target="_blank"><?php echo $v['order_uid'];?></a></td>
                <td><?php echo $v['order_nickname'];?></td>
                <td><?php echo $v['pay_time']? $v['pay_time'] :($v['order_time'] ? $v['order_time'] : $v['create_time']);?></td>

</tr>
<?php } ?>                         
                         
                         
                         
                            </tbody>
        </table>
	<div class="tables-btmctrl clearfix">
           <div class="mgt10">
               <div class="paginate">
                  {$page}
               </div>
           </div>
	</div>
    </div>

</div>
<script>

function excel(){

	var order_id = $("#order_id").val();
	var user_id = $("#user_id").val();
	var logtype = $("#logtype").val();

	var url = "/admin/finance/liushuiexcel/?mtype=2&user_id="
		+user_id+"&logtype="+logtype+"&order_id="+order_id;

var url_1 = "/admin/finance/liushuiexcelpage/?mtype=2&user_id="
	+user_id+"&logtype="+logtype+"&order_id="+order_id;

layer.msg('正在导出,请耐心等待...', {icon: 16});

//分页信息
//查找页数
$.ajax({
	url : url_1,
	type : "GET",
	dataType : 'json',
//	async: false,
	success : function(data) {
		
		layer.closeAll('loading');//关闭正在加载
		if(data.ret == 0){
			// 成功
			var messagetype = 1;
		}else{
			// 失败
			var messagetype = 2;
		}

		layer.msg(data.msg, {icon: messagetype},function(){

			if(data.data==0){
				layer.msg("无数据", {icon: 2});
			}else if(data.data>0){

				var html = '<div style="padding:50px;">';
				for(i=1;i<=data.data;i++){

					var haha = url+"&p="+i;
					

					html += '<br><a href="'+haha+'" target="_blank" style="font-size:20px">下载'+i+'</a><br>';
					
					
				}
				
				html += '</div>';
				
				layer.open({
					title:"请分别点击下面的链接下载文件,每个文件最多包含5000条数据",
				    type: 1,
				    skin: 'layui-layer-rim', //加上边框
				    area: ['500px', '500px'], //宽高
				    content: html
				});
				
				
			}
			
		});
	},
	beforeSend:function(){
		layer.closeAll();//关闭
		layer.load();//正在加载
   },
   error: function() {
	   layer.closeAll('loading');//关闭正在加载
	   layer.msg("网络错误,请重试", {icon: 2});
   }
   
});
	
}

</script>